Skip to content

feat: support performance tracks for server components#1984

Merged
dai-shi merged 11 commits into
mainfrom
support-debug-channel
Mar 20, 2026
Merged

feat: support performance tracks for server components#1984
dai-shi merged 11 commits into
mainfrom
support-debug-channel

Conversation

@dai-shi
Copy link
Copy Markdown
Member

@dai-shi dai-shi commented Mar 13, 2026

Summary

Support performance tracks for server components and server requests.

See: https://react.dev/reference/dev-tools/react-performance-tracks

Notes

  • reuses Vite's HMR websocket for the debug transport
  • patches RSDW in dev so Waku's plain-object payloads keep _debugInfo

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
waku Ready Ready Preview Mar 20, 2026 0:58am

Request Review

@dai-shi dai-shi added this to the v1.0.0-alpha.6 milestone Mar 13, 2026
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci Bot commented Mar 13, 2026

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 13, 2026

Open in StackBlitz

npm i https://pkg.pr.new/waku@1984

commit: 7a7221e

@hi-ogawa
Copy link
Copy Markdown
Collaborator

I was curious about this feature, but couldn't figure out (also haven't research that much). Is there something @vitejs/plugin-rsc need to provide or requires only framework side wiring? If possible, I think I'd also add the wiring in standalone example in @vitejs/plugin-rsc.

@dai-shi
Copy link
Copy Markdown
Member Author

dai-shi commented Mar 16, 2026

@hi-ogawa Thanks. I'm currently working and struggling with it.

  • The biggest issue is that Waku's flight protocol is unique and not supported by React, so I need a hack. Still work in progress
  • The debug channel is implemented with Vite's websocket. I need some refactors, but once done, this might be something that can be ported to @vitejs/plugin-rsc. Will see.

@dai-shi dai-shi marked this pull request as ready for review March 19, 2026 14:12
@dai-shi
Copy link
Copy Markdown
Member Author

dai-shi commented Mar 20, 2026

Is there something @vitejs/plugin-rsc need to provide

In addition to using HMR ws, I implemented part of the feature as a vite plugin, so probably it can be extracted for other framework. And, it will be able to hide the globalThis hack. One of the trickiest parts is to set the custom http header, which I gave up with a hack.

Comment thread packages/waku/src/lib/utils/ssr.ts
@dai-shi dai-shi merged commit 2ce74ee into main Mar 20, 2026
48 of 50 checks passed
@dai-shi dai-shi deleted the support-debug-channel branch March 20, 2026 03:12
unstable_callServerRsc(funcId, args, () => fetchRscStore),
...(import.meta.hot && {
debugChannel: debug?.debugChannel,
findSourceMapURL,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought @vitejs/plugin-rsc/browser bakes-in findSourceMapURL always. Is this customizing something beyond what @vitejs/plugin-rsc provides?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't realize that. So, we can simply delete it here, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dai-shi dai-shi mentioned this pull request Mar 23, 2026
dai-shi added a commit that referenced this pull request Mar 23, 2026
dai-shi added a commit that referenced this pull request May 1, 2026
When I did #1984, I wasn't happy with `renderRscForParse` workaround.
serialize/deserialize should be cleaner apis.
dai-shi added a commit that referenced this pull request May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants